package ${(introspectedTable.tableConfiguration.properties.fileDirectoryApiImpl)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryApiImpl)?index_of("/src/main/java/")+15))?replace("/",".")};

import com.broker.framework.common.pojo.CommonLongRespDTO;
import com.broker.framework.common.pojo.PageParam;
import com.broker.framework.common.pojo.PageResult;
import ${(introspectedTable.tableConfiguration.properties.fileDirectoryDTO)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryDTO)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}DTO;
import ${(introspectedTable.tableConfiguration.properties.fileDirectoryQueryDTO)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryQueryDTO)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}QueryDTO;
import ${(introspectedTable.tableConfiguration.properties.fileDirectoryConvertBiz)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryConvertBiz)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}Convert;
import ${(introspectedTable.tableConfiguration.properties.fileDirectoryDO)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryDO)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}DO;
import com.broker.framework.common.pojo.CommonResult;

import ${(introspectedTable.tableConfiguration.properties.fileDirectoryService)?substring(((introspectedTable.tableConfiguration.properties.fileDirectoryService)?index_of("/src/main/java/")+15))?replace("/",".")}.${className}Service;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

/***
 * ---------------------------
 * @Description: 表备注：${introspectedTable.remarks!}<#--deal null-->
 * 针对表【${introspectedTable.tableConfiguration.schema!}.${introspectedTable.fullyQualifiedTable.introspectedTableName}】的Api实现类
 * ---------------------------
 * @author: ${introspectedTable.tableConfiguration.properties.auther!}
 * @date: ${introspectedTable.tableConfiguration.properties.createTime!}
 * @version: v1.0
 * ---------------------------
 */
@RestController
public class ${className}ApiImpl implements ${className}Api {

    @Resource
    private ${className}Service ${classNameTuoFeng}Service;


    @Override
    public CommonResult<${className}DTO> get(Long id) {
        ${className}DO DO = ${classNameTuoFeng}Service.get(id);
        return CommonResult.success(${className}Convert.INSTANCE.convertToDTO(DO));
    }

    @Override
    public CommonResult<PageResult<${className}DTO>> getPageByQueryDTO(${className}QueryDTO queryDTO, Integer pageNo,  Integer pageSize) {

        return CommonResult.success(${className}Convert.INSTANCE.convertToDTOPage(${classNameTuoFeng}Service.getPageByQueryDTO(queryDTO, new PageParam(pageNo, pageSize))));
    }

    
    @Override
    public CommonResult<List<${className}DTO>> getListByQueryDTO(${className}QueryDTO queryDTO) {
        return CommonResult.success(${classNameTuoFeng}Service.getListByQueryDTO(queryDTO));
    }

    @Override
    public CommonResult<${className}DTO> getOneByQueryDTO(${className}QueryDTO queryDTO) {
        return CommonResult.success(${classNameTuoFeng}Service.getOneByQueryDTO(queryDTO));
    }

    @Override
    public CommonResult<CommonLongRespDTO> countByQueryDTO(${className}QueryDTO queryDTO) {
        return CommonResult.success(${classNameTuoFeng}Service.countByQueryDTO(queryDTO));
    }


    @Override
    public CommonResult<List<${className}DTO>> getListByQueryDTOIgnoreTenantId(${className}QueryDTO queryDTO) {
        return getListByQueryDTO(queryDTO);
    }

    @Override
    public CommonResult<${className}DTO> getOneByQueryDTOIgnoreTenantId(${className}QueryDTO queryDTO) {
        return getOneByQueryDTO(queryDTO);
    }

    @Override
    public CommonResult<CommonLongRespDTO> countByQueryDTOIgnoreTenantId(${className}QueryDTO queryDTO) {
        return countByQueryDTO(queryDTO);
    }


    @Override
    public CommonResult<Object> deleteByQueryDTO(${className}QueryDTO queryDTO) {
        ${classNameTuoFeng}Service.deleteByQueryDTO(queryDTO);

        return CommonResult.success();
    }

    @Override
    public CommonResult<Object> deleteByQueryDTOIgnoreTenantId(${className}QueryDTO queryDTO) {
        return deleteByQueryDTO(queryDTO);
    }

<#list introspectedTable.nonPrimaryKeyColumns as baseColumns>
        <#if baseColumns.actualColumnName?last_index_of("_id")!=-1 && baseColumns.actualColumnName !="tenant_id">
    @Override
    public CommonResult<List<${className}DTO>> getBy${baseColumns.javaProperty?cap_first}(${baseColumns.fullyQualifiedJavaType.shortNameWithoutTypeArguments} ${baseColumns.javaProperty}) {
        return CommonResult.success(${classNameTuoFeng}Service.getBy${baseColumns.javaProperty?cap_first}(${baseColumns.javaProperty}));
    }
        </#if>
</#list>

}